UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oc4KqyglL/gnZCGeOxT+yp8ACTPsXHA16GuqDe9BW/M=' 
WHERE 
  key_id = '80bdb854cade1ba0f468212467cff58e8851b39c6384c9febfa4a05e82ad3834' 
  AND (
    token = 'oc4KqyglL/gnZCGeOxT+yp8ACTPsXHA16GuqDe9BW/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035