UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uQ1CD9QQk0TXU8nS4QX5WrpIwEktKwwm4ekFtCfdFqg=' 
WHERE 
  key_id = '6f100f3a5ad652802f5240e663ccb461b039d5d5aaa8adf12a10b5f06d61872b' 
  AND (
    token = 'uQ1CD9QQk0TXU8nS4QX5WrpIwEktKwwm4ekFtCfdFqg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025