UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eD5wSHu3ymhW1DoRdIBnX9uwIqqhwFGdotcOqo9QCuw=' 
WHERE 
  key_id = '6f3441b65eb5b007406b3e8810791188163541a693f4690efb35e4328003c967' 
  AND (
    token = 'eD5wSHu3ymhW1DoRdIBnX9uwIqqhwFGdotcOqo9QCuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033