UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y//Ruls52V/iZLbm1WVubAh6wpnIqaMA22iw20iALFU=' 
WHERE 
  key_id = '2c49c5644f9212f3cf0eaf537f07fc933b3a5e2be04540892f62434d54615577' 
  AND (
    token = 'Y//Ruls52V/iZLbm1WVubAh6wpnIqaMA22iw20iALFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045