UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wZn/Ng6L0m0uZ6gfeF9kcBueyoEd8VUkHvAv+sNGgfM=' 
WHERE 
  key_id = 'a6053e2fcaff20b0bef88d7c5cdec321022218068fd8063849dfd44452fde6bd' 
  AND (
    token = 'wZn/Ng6L0m0uZ6gfeF9kcBueyoEd8VUkHvAv+sNGgfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034