UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ceOfYflWx5Qmk+maazUzJqoO8r7pCHUMxBYsEU3Q/WE=' 
WHERE 
  key_id = 'cd4768e876eec4a39195dcd3430d6ffce45a0448f7cd1f6cc52e1239f531598a' 
  AND (
    token = 'ceOfYflWx5Qmk+maazUzJqoO8r7pCHUMxBYsEU3Q/WE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040