UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LSW6toSYkkyFFMRbq4l/V9PE0uH47+pzgF5IdDkcK1g=' 
WHERE 
  key_id = '296576c9b1603dba84c071d73c5b2af2be8a6c47efcd7404a7e26467c3d5d68e' 
  AND (
    token = 'LSW6toSYkkyFFMRbq4l/V9PE0uH47+pzgF5IdDkcK1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018