UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hwq7O/6T1hPb5gv+beMFz639RPsHHzXQ7kF/7Nj7BMM=' 
WHERE 
  key_id = '3b1ce6d5178b7853c94cf3ea6fd72499739b4604ab8f3808cfc795eadaa90010' 
  AND (
    token = 'Hwq7O/6T1hPb5gv+beMFz639RPsHHzXQ7kF/7Nj7BMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027