UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vl8mks3VyMjNp1pVCQ3vnRfSJlDB3XaGcRxW+s0YLNM=' 
WHERE 
  key_id = 'cffd850f0304184d9fcdde67fa2e5a2a6a4bae484872c849c2a8ced10edfe86d' 
  AND (
    token = 'vl8mks3VyMjNp1pVCQ3vnRfSJlDB3XaGcRxW+s0YLNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024