UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'glJJZK1E2zQhSzOucuH+lRk5Ixh/keVsUkeK2j56ny8=' 
WHERE 
  key_id = '4d66826321f86f799fcf1831f463d40eb66bf95879900606dc7865e211d03f32' 
  AND (
    token = 'glJJZK1E2zQhSzOucuH+lRk5Ixh/keVsUkeK2j56ny8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036