UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IA99U41nRJxvERHT9aq5jTYhuwfrlxedDxZRHUlERes=' 
WHERE 
  key_id = 'e10010898296ea187b96d55549038313023fc9fd56b00f2f7a29b2090330dbd1' 
  AND (
    token = 'IA99U41nRJxvERHT9aq5jTYhuwfrlxedDxZRHUlERes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032