UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HcgaPULKmHcCohWRWZjHHfKh4Wx8FyfsMaQeoLhD+wQ=' 
WHERE 
  key_id = '9b4fc069220add376d4ba9b4ff209d0a5bd0998f27f190e882690168e17a8365' 
  AND (
    token = 'HcgaPULKmHcCohWRWZjHHfKh4Wx8FyfsMaQeoLhD+wQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044