UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3zyge4WkbrShRQbqxLf+r7LlQGSFcO+AfJXscwys1BM=' 
WHERE 
  key_id = '6e63b2c1cdb86f72197b4f3674ea14ac46057855a10b9a7179bb2693115d77b8' 
  AND (
    token = '3zyge4WkbrShRQbqxLf+r7LlQGSFcO+AfJXscwys1BM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031