UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C5iiNjMa37266n9HCdXgAM1Tp8zvtpTYMpSWvIGbLqk=' 
WHERE 
  key_id = '4852b4144df60490f0795f971cd9943b23b41aea968eb67cda1129eea0103e65' 
  AND (
    token = 'C5iiNjMa37266n9HCdXgAM1Tp8zvtpTYMpSWvIGbLqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040