UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ayzXL5ADzHGmVUboSBn4YOXKm5XbdxnQZDGNKsZnZNY=' 
WHERE 
  key_id = '502c38f110bd9b7683aa0d479e1b0eb51fa7eaade9c6dd1af08f0ccb79913dae' 
  AND (
    token = 'ayzXL5ADzHGmVUboSBn4YOXKm5XbdxnQZDGNKsZnZNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029