UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lef8Lic3CwGGxD4Rn3yQ5OVKYSh/SNhsNW2Bh18y2uM=' 
WHERE 
  key_id = '7d80bc668bbaab2d0e7370a9a52f9addb04b52195712ff37e4cb62d2f5262a39' 
  AND (
    token = 'lef8Lic3CwGGxD4Rn3yQ5OVKYSh/SNhsNW2Bh18y2uM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048