UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TL95UMxenXFmfK4u8EKVfwRUteMF430l6swFRWiuCdU=' 
WHERE 
  key_id = '83bf2638325e8633166c6bbffde758064738ba60cb7fc90b8147e67961bf00ff' 
  AND (
    token = 'TL95UMxenXFmfK4u8EKVfwRUteMF430l6swFRWiuCdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045