UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hMMuQigNc2qANM6eIWhMlKVN8/VIcp1PgKQgDcqWrhY=' 
WHERE 
  key_id = 'a385a66ccebe7f88d0dba6d57e76792fee838e64fa233dfcb0715ecfdef934ef' 
  AND (
    token = 'hMMuQigNc2qANM6eIWhMlKVN8/VIcp1PgKQgDcqWrhY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045