UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eRU1Dx8mLwebFNRK+ZsoipUmOyef+C6LEDzsR4LTbxw=' 
WHERE 
  key_id = '7c280912992b27a81de8f79b936ed311c947359cd6dc527688f6e7f6a3d965de' 
  AND (
    token = 'eRU1Dx8mLwebFNRK+ZsoipUmOyef+C6LEDzsR4LTbxw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040