UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iezeJi8zL311KgVxHYQOu7CIccF+Kq9o8kQivXs8fnA=' 
WHERE 
  key_id = '22fe9100aa022ef7633bc4dc7641e098107325878dff90dcc59cd8cf2f0fdd99' 
  AND (
    token = 'iezeJi8zL311KgVxHYQOu7CIccF+Kq9o8kQivXs8fnA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040