UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w4hRwM3efGpHjDtVrfZ78t4CDBkPDcb8D46xPLdMlkY=' 
WHERE 
  key_id = '295bb5e02b1ac867d84eccf328b89f7e1cd93badd6b24bcccb1c4e01750d135b' 
  AND (
    token = 'w4hRwM3efGpHjDtVrfZ78t4CDBkPDcb8D46xPLdMlkY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048