UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0SuXPEotXndjkoyDCrFA7IYpP4EuthfNgGIVn2him8=' 
WHERE 
  key_id = '26a2fa9b91494b9367f52d32fd731f7030726e03bf04dbc692e8c015f7c5375d' 
  AND (
    token = 'O0SuXPEotXndjkoyDCrFA7IYpP4EuthfNgGIVn2him8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044