UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9aGaYQHDBmK/IXzgVBZlhwbaW5dnz/+Y36GlI1yDuy0=' 
WHERE 
  key_id = 'afe2c98d8e95622b31d8ebe33008b28217ced79fb74dfdd02a0152685255ce0e' 
  AND (
    token = '9aGaYQHDBmK/IXzgVBZlhwbaW5dnz/+Y36GlI1yDuy0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046