UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vfrxi3mtlIKmWZomDwTJ5D0aj6ni11NJbtaP7e5wfQ4=' 
WHERE 
  key_id = 'fe2b2d47410143f1160fb517c736c705e7163cd5f3259a5f5c6fb94660e02ad6' 
  AND (
    token = 'vfrxi3mtlIKmWZomDwTJ5D0aj6ni11NJbtaP7e5wfQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030