UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ecKG37kTzJg5CvivHx2vGxahYWAdeKv1tqcmDaACQQA=' 
WHERE 
  key_id = '1e4dc95a5bf10fc256386c5c160d5b68223f0271693a66b8cbe6d585b405d501' 
  AND (
    token = 'ecKG37kTzJg5CvivHx2vGxahYWAdeKv1tqcmDaACQQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020