UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dYABUTUQuwS4fHKrNRjIVjp1TEzPfimI8RISyi+qWTo=' 
WHERE 
  key_id = '80b4d9117d8b4b26b008d464217a8534ebd6280acfc9b3076cca4806002b3669' 
  AND (
    token = 'dYABUTUQuwS4fHKrNRjIVjp1TEzPfimI8RISyi+qWTo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052