UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wrPw3hxMaXW8humkP9jRHQc4AdoQAi0hYxvcXlUjPAM=' 
WHERE 
  key_id = '527bfea278802506048712da5f74ad26ca943275c1880f15a4bd493e6a5009ea' 
  AND (
    token = 'wrPw3hxMaXW8humkP9jRHQc4AdoQAi0hYxvcXlUjPAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025