UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a5UMd2RwyBL78A11puc0VrFORYh161oiUU9LOKavsg8=' 
WHERE 
  key_id = '1819d91c27dfe9154fafcea52c8d5275a7ae9d082cc917da957249b6a5bae728' 
  AND (
    token = 'a5UMd2RwyBL78A11puc0VrFORYh161oiUU9LOKavsg8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022