UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NnmGJO5vF4gxe2ztVyoUc91/MeCaT5ePBoIrEukOlqk=' 
WHERE 
  key_id = 'e2266dfcea856c008b330da9024c6f856d3fb27a2d3cadbef32ddea3ad5aa885' 
  AND (
    token = 'NnmGJO5vF4gxe2ztVyoUc91/MeCaT5ePBoIrEukOlqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037