UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z9691sNJ3R6PtIWnNLyIZWTRHnHn2FDVgbitXN9WGPo=' 
WHERE 
  key_id = '1051f5ddccbbec624bbb0ec29f217caba551abd35335769529550cd907a450c6' 
  AND (
    token = 'Z9691sNJ3R6PtIWnNLyIZWTRHnHn2FDVgbitXN9WGPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043