UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QWeI8UlV+GPdx5SXxkTz1o+ZjPdHKaUNFmda4Pesms0=' 
WHERE 
  key_id = '2fa4ae5943bfd566f2bd9588c2481934a4feea827a4d96aa72bab38f2dc50182' 
  AND (
    token = 'QWeI8UlV+GPdx5SXxkTz1o+ZjPdHKaUNFmda4Pesms0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040